package com.bizmerce.rnd.oms.cmmn.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

public class ControllerInterceptor extends HandlerInterceptorAdapter {

    private Log logger = LogFactory.getLog(this.getClass());
    
    private final String MARK = "======================================================================";
    
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
    	        
        logger.debug(MARK);
        logger.debug("Entered "+handler.getClass().getName());
        logger.debug(request.getRequestURI());
        
        return super.preHandle(request, response, handler);
    }
    

    @Override
    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, org.springframework.web.servlet.ModelAndView modelAndView) throws Exception {
    }
    
    @Override
    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
        logger.debug(MARK+"\n\n");        
    }
    
    
}